package com.example.back.controller;


import com.example.back.dto.req.AdminEditReq;
import com.example.back.dto.req.AdminReq;
import com.example.back.dto.resp.AdminResp;
import com.example.back.dto.resp.HospitalDepartmentListResp;
import com.example.back.service.AdminService;
import com.example.common.support.Result;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;



@RestController
@Api(tags = "账号管理")
@RequestMapping("/DSys/Admin")
public class AdminController {

    @Resource
    private AdminService AdminService;

    @ApiOperation(value = "获取账号管理列表", notes = "获取账号管理列表")
    @PostMapping(value = "/list")
    public Result<PageInfo<AdminResp>> list(@RequestBody AdminReq req) {
        return Result.success(AdminService.list(req));
    }


    @ApiOperation(value = "新增和修改管理账号", notes = "新增和修改管理账号")
    @PostMapping(value = "/commitSave")
    public Result<Object> commitSave(@RequestBody AdminEditReq req) {
        return Result.success(AdminService.commitSave(req));
    }


    @ApiOperation(value = "禁用管理账户", notes = "禁用管理账户")
    @PostMapping(value = "/updateDisable")
    public Result<Object> updateDisable(@RequestBody AdminReq req) {
        return Result.success(AdminService.updateDisable(req));
    }

    @ApiOperation(value = "导出账号", notes = "导出账号")
    @PostMapping(value = "/ExportXls")
    public Result<Object> ExportXls(@RequestBody AdminReq req){
        return Result.success(AdminService.ExportXls(req));
    }

    @ApiOperation(value = "删除管理账户", notes = "删除管理账户")
    @PostMapping(value = "/commitDel")
    public Result<Object> commitDel(@RequestBody AdminReq req) {
        return Result.success(AdminService.commitDel(req));
    }


    @ApiOperation(value = "角色科室分类", notes = "角色科室分类")
    @PostMapping(value = "/ClassIficationList")
    public Result<HospitalDepartmentListResp> ClassIficationList() {
        return Result.success(AdminService.ClassIficationList());
    }
}
